<?php

namespace App\Http\Controllers\Admin;

use App\Logic\SettingsLogic;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class SettingsController extends BaseController
{

    public function create()
    {
        return view('admin.finance.create');
    }

    /**
     * @param AgetnRequest $request
     * @return array
     */
    public function store(Request $request)
    {
        $agentLogicModel = new SettingsLogic();

        $info = $agentLogicModel->create($request);
        //dd($company_info);
        if($info){
            flash('添加成功')->success()->important();
        }else{
            flash('添加失败')->error()->important();
        }

        return redirect()->route('settings.index');

    }


    /**
     * @param AgentRequest $request
     * @param $id
     * @return RedirectResponse
     */
    public function update(Request $request,$id)
    {
        $agentLogicModel = new SettingsLogic();
        $info = $agentLogicModel->update($request,$id);
        if($info){
            flash('更新成功')->success()->important();
        }
        else{
            flash('更新失败')->error()->important();
        }

        return redirect()->route('settings.index');
    }
	
}
